<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">

<ui:composition template="/page/template/admin_main.xhtml">

	<ui:define name="title">
			Admin
	</ui:define>

	<ui:define name="content">
		<div class="adminContent">
			<div class="article-container">
				<h3>تعديل الطلب</h3>

				<div class="article-separator"></div>

				<div class="clear-floating"></div>

				<h:form id="f1">
					<p:growl id="messagesGrowl" showDetail="true"/>
					<p:messages id="messages" />
					
					<p:outputLabel id="ol1" value="العنوان" for="it1"/>
					<p:inputText id="it1" value="#{embassyServicesHandlerBean.service.title}" style="width:300px;text-align:right"  required="true" requiredMessage="الرجاء ادخال العنوان" />
					<div class="clear-floating" />
					<br/>

					<p:editor id="editor" value="#{embassyServicesHandlerBean.service.body}" height="250" width="750" required="true" requiredMessage="الرجاء ادخال الموضوع" />
					<br/>

					<p:dataTable id="dt" value="#{embassyServicesHandlerBean.service.attachments}" var="attachment" styleClass="data-table">
						<p:column headerText="الاجراءات">
							<p:commandLink value="حذف" immediate="true" update="dt"
								action="#{embassyServicesHandlerBean.deleteAttachment(attachment)}" ajax="true" />
						</p:column>
						<p:column headerText="اسم الملف" width="70%">
							<p:inputText value="#{attachment.attachmentTitle}"  style="width:300px;text-align:right" />
						</p:column>
					</p:dataTable>

					<br/>

					<p:fileUpload fileUploadListener="#{embassyServicesHandlerBean.handleFileUpload}" mode="advanced" dragDropSupport="false" 
						uploadLabel="تحميل الملفات" cancelLabel="الغاء التحميل" label="اختيار الملفات" invalidFileMessage="نوع الملف غير صحيح" invalidSizeMessage="حجم الملف اكبر من الحد المسموح"
                 		multiple="true" update="messagesGrowl,dt" sizeLimit="4000000" fileLimit="3" allowTypes="/(\.|\/)(gif|jpe?g|png|pdf)$/" />
  
					<br/>
					
					<p:commandButton id="cb1" action="#{embassyServicesHandlerBean.editEmbassyService}" value="حفظ" update="messages" ajax="false" />
				</h:form>

			</div>
			<div class="clear-floating"></div>

		</div>
	</ui:define>

</ui:composition>
</html>